1. /* slfllcmp.cpp by K.Tsuru */
  2. // function ID = 206 DRADIX, BRADIX
  3. /*******************************************************
  4. SLong and SInteger classes
  5. Comparing |m| and |n| it returns the following values.
  6. |m| > |n| : 1
  7. |m| == |n| : 0
  8. |m| < |n| : -1
  9. which are the same as strcmp() and memcmp().
  10. ********************************************************/
  11. #ifndef SN_H
  12. #include "sn.h"
  13. #endif
  14. int LLCompare(const SLong& m, const SLong& n) {
  15. // m = 0 || n = 0
  16. if(!m.Sign(206) || !n.Sign(206)) return abs(m.Sign()) - abs(n.Sign());
  17. if(&m == &n) return 0; // same object
  18. if(m.Type() != n.Type()) m.SetError(m.RADIX_ERR, "LLCompare", 206);
  19. //The number of figures is different.
  20. if( m.aHead != n.aHead ) return m.aHead > n.aHead ? 1 : -1;
  21. //Here m.aHead = n.aHead.
  22. const fType* mv = m.ReadFigures();
  23. const fType* nv = n.ReadFigures();
  24. register int i;
  25. for(i = (int)m.aHead ; i >= 0; i--) //compare from top
  26. if( mv[i] != nv[i] ) return mv[i] > nv[i] ? 1 : -1;
  27. return 0; //the same value
  28. }

slfllcmp.cpp : last modifiled at 2017/03/13 14:32:00(1,035 bytes)
created at 2017/10/07 10:26:50
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).